package com.fis.hlo.pm.persistence;

import java.math.BigDecimal;


public class CustomTmpIrAdj extends TmpIrAdj {

	protected boolean selected;
	protected BigDecimal adjustAmount;
	protected BigDecimal adjustedAmount;

	/**
	 * @return the adjustedAmount
	 */
	public BigDecimal getAdjustedAmount() {
		return adjustedAmount;
	}

	/**
	 * @param adjustedAmount
	 *            the adjustedAmount to set
	 */
	public void setAdjustedAmount(BigDecimal adjustedAmount) {
		this.adjustedAmount = adjustedAmount;
	}

	public BigDecimal getAdjustAmount() {

		if (adjustAmount == null && this.getHcharge() != null
				&& this.getHchargeCorrect() != null
				&& this.getHchargeCorrect().doubleValue() > 0)
			adjustAmount = this.getHchargeCorrect().subtract(this.getHcharge());

		return this.adjustAmount;
	}

	public void setAdjustAmount(BigDecimal adjAmount) {
		this.adjustAmount = adjAmount;
	}

	/**
	 * @return the selected
	 */
	public boolean isSelected() {
		return selected;
	}

	/**
	 * @param selected
	 *            the selected to set
	 */
	public void setSelected(boolean selected) {
		this.selected = selected;
	}

	public CustomTmpIrAdj parseClass(TmpIrAdj tmpIrAdj) {

		if (tmpIrAdj != null) {

			this.setCreateDate(tmpIrAdj.getCreateDate());
			this.setCycle(tmpIrAdj.getCycle());
			this.setCycleId(tmpIrAdj.getCycleId());
			this.setHcharge(tmpIrAdj.getHcharge());
			this.setHchargeCorrect(tmpIrAdj.getHchargeCorrect());
			this.setInvoice(tmpIrAdj.getInvoice());
			this.setInvoiceId(tmpIrAdj.getInvoiceId());
			this.setInvoiceNo(tmpIrAdj.getInvoiceNo());
			this.setIsProcessed(tmpIrAdj.getIsProcessed());
			this.setMonth(tmpIrAdj.getMonth());
			this.setObject(tmpIrAdj.getObject());
			this.setObjectId(tmpIrAdj.getObjectId());
			this.setPlmnId(tmpIrAdj.getPlmnId());
			this.setTapfileId(tmpIrAdj.getTapfileId());
			this.setTaxAmount(tmpIrAdj.getTaxAmount());
			this.setSelected(false);

			return this;

		}

		return null;

	}
}
